{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<style type="text/css">
    .link-th{
        color:blue;
    }
</style>
<section class="panel">
    <header class="panel-heading">
        <h4>会员列表</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">

        <table class="table table-bordered table-striped no-margin">
            <thead>
            <tr>
                <th class="text-center">ID</th>
                <th class="text-center">基本信息</th>
                <th class="text-center">注册时间</th>
                <th class="text-center">用户等级</th>
                <th class="text-center">机器编号</th>
                <th class="text-center">地址</th>
            </tr>
            </thead>
            <tbody>
            {if !empty($list)}
                {foreach $list as $entity}
                <tr>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity->id}
                    </td>
                    <td style="vertical-align: middle" class="">
                        手机号：{$entity->mobile}<br>
                        真实姓名：{$entity->real_name}<br>
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity->register_time}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {$user->getOneLevel($entity->level)}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity->pos}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity->province} {$entity->city} {$entity->area} {$entity->address}
                    </td>

                </tr>
                {/foreach}
            {else /}
            <tr class="text-center">
                <td colspan="9">暂无数据</td>
            </tr>
            {/if}
            </tbody>
        </table>
        <div class="page">
            {:htmlspecialchars_decode($list->render())}
        </div>
    </div>
</section>
{/block}
{block name="footer"}
<form action="{:url('admin/user/exportUser')}" id="exportForm">
    <input type="hidden" name="type" id="e_type">
    <input type="hidden" name="keyword" id="e_keyword">
    <input type="hidden" name="level" id="e_level">
</form> 
<script>
    function showContent(e){
        $.dialog({
            title: '支付宝收款码',
            content: $(e).attr('data-content')
        });
    }
    //导出会员信息
    $("#export").click(function(){
        var level = $("#level").val();
        var keyword = $("#keyword").val();
        var type = $("#type").val();
        $('#e_level').val(level);
        $('#e_keyword').val(keyword);
        $('#e_type').val(type);
        $("#exportForm").submit();
    })

    //修改会员买卖状态
    function changeTrad(type,status,id) {
        $.ajax({
            url:"{:url('user/changeTrad')}",
            dataTye:'json',
            type:'post',
            data:{type:type, status:status, id:id},
            success:function (data) {
                console.log(data)
                main.waringAlert(data.message);
                if(data.code == 1)
                {
                    window.location.reload();
                    return false;
                }
            }
        })
    }
</script>

{/block}
